package global

import (
	"log"
	"os"

	"github.com/BurntSushi/toml"
)

var Config ServerConfig

func init() {
	pwd, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
	}

	path := pwd + "/backend/configure/etc/mysql.toml"
	if _, err := toml.DecodeFile(path, &Config); err != nil {
		log.Fatal(err)
	}
}

type ServerConfig struct {
	Mysql MysqlConfig
}

type MysqlConfig struct {
	Server   string
	Port     int
	Name     string
	User     string
	Password string
}
